<?php
class ReportModel
{
    public function __construct()
    {
		$this->db = Yaf_Registry::get('db');
    }
   
    public function selectPushInfoByTime($info)
    {
        date_default_timezone_set('PRC');
        
        foreach ($info as $key => $value) {
            $next_day = strtotime($value) + 3600*24;
            $sql="select count(DISTINCT article_id) as counts from push_log where status='2' and `create_time`>UNIX_TIMESTAMP('{$value}') and `create_time`< '{$next_day}'";
            $result[$key] = $this->db->query($sql);
            //var_dump($sql);
        }
        return $result;
    }

    public function selectPushErrorInfoByTime($info)
    {
        date_default_timezone_set('PRC');
        
        foreach ($info as $key => $value) {
            $next_day = strtotime($value) + 3600*24;
            $sql="select count(status) as counts from article where status='1' and `create_time`>UNIX_TIMESTAMP('{$value}') and `create_time`< '{$next_day}'";
            $result[$key] = $this->db->query($sql);
            //var_dump($sql);
        }
        return $result;
    }
}